<!DOCTYPE html>
<html lang="zh-CN">
<html lang="zh-CN">
<html lang="en">
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <style>
        .bigbox {
            display: flex;
            width: 500px;
            justify-content: space-around;
        }

        .box {
            background-color: rgb(245, 124, 124);
            height: 36px;
            width: 90px;
            border-radius: 25px;
            text-align: center;
            line-height: 36px;
            /* cursor: inherit; */
        }

        .content {
            /* display: none; */
            text-align: center;
            width: 500px;
            height: 300px;
            line-height: 300px;
            position: absolute;
        }

        .green{
            background-color: lawngreen;
        }
        .red{
            background-color: rgb(252, 50, 0);
        }
        .skybule{
            background-color: rgb(81, 244, 250);
        }
        .yello{
            background-color: rgb(247, 250, 81);
        }
    </style>

    <div id="app">
        <div class="bigbox">
            <div class="box" v-for="(item,idx) in title" v-on:click="handler(idx)">
                {{item.item}}
            </div>
        </div>
        <div class="content" v-bind:class="classStr[idx]">
            <!-- v-for="item in contents" -->
            {{contents[idx].item}}
        </div>
    </div>
    <script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>
    <script>
        let vm = new Vue({
            el: '#app',
            data: {
                title: [
                    { item: 'html' },
                    { item: 'css' },
                    { item: 'js' },
                    { item: 'vuejs' },
                ],
                contents: [
                    { item: 'html-contents' },
                    { item: 'css-contents' },
                    { item: 'js-contents' },
                    { item: 'vuejs-contents' },
                ],
                idx:0,
                classStr:['green','red','skybule','yello']
            },
            methods: {
                handler(idx) {
                    this.idx= idx
                }
            }
        })
    </script>
</body>

</html>